package my.graduation.config;

import my.graduation.properties.SMSProperties;
import my.graduation.util.SMSUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: RavenLyn
 * @Date: 2025-03-06
 */
@Configuration
public class SMSConfig {
    @Bean
    @ConditionalOnMissingBean
    public SMSUtil smsUtil(SMSProperties smsProperties){
        return new SMSUtil(
                smsProperties.getHost(),
                smsProperties.getPath(),
                smsProperties.getAppkey(),
                smsProperties.getAppsecret(),
                smsProperties.getSmsSignId(),
                smsProperties.getTemplateId());
    }
}
